package cn.jbolt.ai.resource.llm.service.impl;

import cn.jbolt.ai.resource.llm.service.AiModelTypeService;
import cn.jbolt.util.Result;
import com.jboltai.resource.ai.AIModel;
import org.springframework.stereotype.Service;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;


@Service
public class AiModelTypeServiceImpl implements AiModelTypeService {


    public Result<List<Map<String, Object>>> getList() {
        List<AIModel> models = AIModel.listAll();
        return Result.success(models.stream().filter(item -> item != AIModel.LOCAL_MODEL).map(model -> {
            Map<String, Object> map = new LinkedHashMap<>();
            map.put("sn", model.getSn());
            map.put("name", model.getName());
            map.put("configItem", model.getConfigItems());
            return map;
        }).collect(Collectors.toList()));
    }

}
